package com.controller;

import com.dto.JsonResult;
import com.entity.SysServer;
import com.service.ServerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Yadasu
 * @date 2021/1/28 16:39
 */
@RestController
public class ServerController {

    @Autowired
    private ServerService serverService;


    /**
     * 获取服务器信息
     * @return
     */
    @GetMapping("/api/server")
    public JsonResult getServerInfo(){
        return JsonResult.buildSuccess(200,serverService.findAll());
    }

    /**
     * 新增服务器
     * @param sysServer
     * @return
     */
    @PutMapping("/api/project/addServer")
    public JsonResult addProjectServer(@RequestBody SysServer sysServer) {
        return JsonResult.buildSuccess(200, serverService.addProjectServer(sysServer));
    }
}
